package com.ruowei.modules.foodOrder.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.*;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 商品信息表
 */
@ApiModel(description = "商品信息表")
@Entity
@Table(name = "merchandise")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Merchandise implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 商品编码
     */
    @ApiModelProperty(value = "商品编码")
    @Column(name = "merchandise_code")
    private String merchandiseCode;

    /**
     * 商品名称
     */
    @ApiModelProperty(value = "商品名称")
    @Column(name = "merchandise_name")
    private String merchandiseName;

    /**
     * 商家编码
     */
    @ApiModelProperty(value = "商家编码")
    @Column(name = "merchant_code")
    private String merchantCode;

    /**
     * 分类编码
     */
    @ApiModelProperty(value = "分类编码")
    @Column(name = "type_code")
    private String typeCode;

    /**
     * 图片
     */
    @Size(max = 2000)
    @ApiModelProperty(value = "图片")
    @Column(name = "photos", length = 2000)
    private String photos;

    /**
     * 删除状态
     */
    @ApiModelProperty(value = "删除状态")
    @Column(name = "delete_status")
    private Boolean deleteStatus;

    /**
     * 发布状态
     */
    @ApiModelProperty(value = "发布状态")
    @Column(name = "publish_status")
    private Boolean publishStatus;

    /**
     * 审核状态
     */
    @ApiModelProperty(value = "审核状态")
    @Column(name = "verify_status")
    private String verifyStatus;

    /**
     * 是否新品
     */
    @ApiModelProperty(value = "是否新品")
    @Column(name = "new_status")
    private Boolean newStatus;

    /**
     * 是否参与满减
     */
    @ApiModelProperty(value = "是否参与满减")
    @Column(name = "participate_full_discount")
    private Boolean participateFullDiscount;

    /**
     * 是否推荐
     */
    @ApiModelProperty(value = "是否推荐")
    @Column(name = "recommend_status")
    private Boolean recommendStatus;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @Column(name = "jhi_sort")
    private Integer sort;

    /**
     * 总销量
     */
    @ApiModelProperty(value = "总销量")
    @Column(name = "sale")
    private Long sale;

    /**
     * 单位
     */
    @ApiModelProperty(value = "单位")
    @Column(name = "unit")
    private String unit;

    /**
     * 以逗号分割的产品服务：1->无忧退货；2->快速退款；3->免费包邮
     */
    @ApiModelProperty(value = "以逗号分割的产品服务：1->无忧退货；2->快速退款；3->免费包邮")
    @Column(name = "service_ids")
    private String serviceIds;

    /**
     * 活动限购数量
     */
    @ApiModelProperty(value = "活动限购数量")
    @Column(name = "promotion_per_limit")
    private Integer promotionPerLimit;

    /**
     * 商品描述
     */
    @Size(max = 2000)
    @ApiModelProperty(value = "商品描述")
    @Column(name = "description", length = 2000)
    private String description;

    /**
     * 商品描述图片
     */
    @Size(max = 2000)
    @ApiModelProperty(value = "商品描述图片")
    @Column(name = "description_pictures", length = 2000)
    private String descriptionPictures;

    /**
     * 赠送的成长值
     */
    @ApiModelProperty(value = "赠送的成长值")
    @Column(name = "gift_growth")
    private Integer giftGrowth;

    /**
     * 赠送的积分
     */
    @ApiModelProperty(value = "赠送的积分")
    @Column(name = "gift_point")
    private Integer giftPoint;

    /**
     * 限制使用的积分数
     */
    @ApiModelProperty(value = "限制使用的积分数")
    @Column(name = "use_point_limit")
    private Integer usePointLimit;

    /**
     * 评分
     */
    @ApiModelProperty(value = "评分")
    @Column(name = "score", precision = 21, scale = 2)
    private BigDecimal score;

    /**
     * 默认价格
     */
    @ApiModelProperty(value = "默认价格")
    @Column(name = "price", precision = 21, scale = 2)
    private BigDecimal price;

    /**
     * 好评度
     */
    @ApiModelProperty(value = "好评度")
    @Column(name = "praise_proportion")
    private String praiseProportion;

    /**
     * 商品参数json
     */
    @ApiModelProperty(value = "商品参数json")
    @Lob
    @Column(name = "parameters")
    private String parameters;

    public Merchandise() {
    }

    public Merchandise(Merchandise merchandise) {
        this.id = merchandise.id;
        this.merchandiseCode = merchandise.merchandiseCode;
        this.merchandiseName = merchandise.merchandiseName;
        this.merchantCode = merchandise.merchantCode;
        this.typeCode = merchandise.typeCode;
        this.photos = merchandise.photos;
        this.deleteStatus = merchandise.deleteStatus;
        this.publishStatus = merchandise.publishStatus;
        this.verifyStatus = merchandise.verifyStatus;
        this.newStatus = merchandise.newStatus;
        this.participateFullDiscount = merchandise.participateFullDiscount;
        this.recommendStatus = merchandise.recommendStatus;
        this.sort = merchandise.sort;
        this.sale = merchandise.sale;
        this.unit = merchandise.unit;
        this.serviceIds = merchandise.serviceIds;
        this.promotionPerLimit = merchandise.promotionPerLimit;
        this.description = merchandise.description;
        this.descriptionPictures = merchandise.descriptionPictures;
        this.giftGrowth = merchandise.giftGrowth;
        this.giftPoint = merchandise.giftPoint;
        this.usePointLimit = merchandise.usePointLimit;
        this.score = merchandise.score;
        this.praiseProportion = merchandise.praiseProportion;
        this.parameters = merchandise.parameters;
        this.price = merchandise.getPrice();
    }

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getMerchandiseCode() {
        return merchandiseCode;
    }

    public Merchandise merchandiseCode(String merchandiseCode) {
        this.merchandiseCode = merchandiseCode;
        return this;
    }

    public String getVerifyStatus() {
        return verifyStatus;
    }

    public void setVerifyStatus(String verifyStatus) {
        this.verifyStatus = verifyStatus;
    }

    public void setMerchandiseCode(String merchandiseCode) {
        this.merchandiseCode = merchandiseCode;
    }

    public String getMerchandiseName() {
        return merchandiseName;
    }

    public Merchandise merchandiseName(String merchandiseName) {
        this.merchandiseName = merchandiseName;
        return this;
    }

    public void setMerchandiseName(String merchandiseName) {
        this.merchandiseName = merchandiseName;
    }

    public String getMerchantCode() {
        return merchantCode;
    }

    public Merchandise merchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
        return this;
    }

    public void setMerchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public Merchandise typeCode(String typeCode) {
        this.typeCode = typeCode;
        return this;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode;
    }

    public String getPhotos() {
        return photos;
    }

    public Merchandise photos(String photos) {
        this.photos = photos;
        return this;
    }

    public void setPhotos(String photos) {
        this.photos = photos;
    }

    public Boolean isParticipateFullDiscount() {
        return participateFullDiscount;
    }

    public Merchandise participateFullDiscount(Boolean participateFullDiscount) {
        this.participateFullDiscount = participateFullDiscount;
        return this;
    }

    public void setParticipateFullDiscount(Boolean participateFullDiscount) {
        this.participateFullDiscount = participateFullDiscount;
    }

    public Boolean isDeleteStatus() {
        return deleteStatus;
    }

    public Merchandise deleteStatus(Boolean deleteStatus) {
        this.deleteStatus = deleteStatus;
        return this;
    }

    public void setDeleteStatus(Boolean deleteStatus) {
        this.deleteStatus = deleteStatus;
    }

    public Boolean isPublishStatus() {
        return publishStatus;
    }

    public Merchandise publishStatus(Boolean publishStatus) {
        this.publishStatus = publishStatus;
        return this;
    }

    public void setPublishStatus(Boolean publishStatus) {
        this.publishStatus = publishStatus;
    }

    public Boolean isNewStatus() {
        return newStatus;
    }

    public Merchandise newStatus(Boolean newStatus) {
        this.newStatus = newStatus;
        return this;
    }

    public void setNewStatus(Boolean newStatus) {
        this.newStatus = newStatus;
    }

    public Boolean isRecommendStatus() {
        return recommendStatus;
    }

    public Merchandise recommendStatus(Boolean recommendStatus) {
        this.recommendStatus = recommendStatus;
        return this;
    }

    public void setRecommendStatus(Boolean recommendStatus) {
        this.recommendStatus = recommendStatus;
    }

    public Integer getSort() {
        return sort;
    }

    public Merchandise sort(Integer sort) {
        this.sort = sort;
        return this;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Long getSale() {
        return sale;
    }

    public Merchandise sale(Long sale) {
        this.sale = sale;
        return this;
    }

    public void setSale(Long sale) {
        this.sale = sale;
    }

    public String getUnit() {
        return unit;
    }

    public Merchandise unit(String unit) {
        this.unit = unit;
        return this;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getServiceIds() {
        return serviceIds;
    }

    public Merchandise serviceIds(String serviceIds) {
        this.serviceIds = serviceIds;
        return this;
    }

    public void setServiceIds(String serviceIds) {
        this.serviceIds = serviceIds;
    }

    public Integer getPromotionPerLimit() {
        return promotionPerLimit;
    }

    public Merchandise promotionPerLimit(Integer promotionPerLimit) {
        this.promotionPerLimit = promotionPerLimit;
        return this;
    }

    public void setPromotionPerLimit(Integer promotionPerLimit) {
        this.promotionPerLimit = promotionPerLimit;
    }

    public String getDescription() {
        return description;
    }

    public Merchandise description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDescriptionPictures() {
        return descriptionPictures;
    }

    public Merchandise descriptionPictures(String descriptionPictures) {
        this.descriptionPictures = descriptionPictures;
        return this;
    }

    public void setDescriptionPictures(String descriptionPictures) {
        this.descriptionPictures = descriptionPictures;
    }

    public Integer getGiftGrowth() {
        return giftGrowth;
    }

    public Merchandise giftGrowth(Integer giftGrowth) {
        this.giftGrowth = giftGrowth;
        return this;
    }

    public void setGiftGrowth(Integer giftGrowth) {
        this.giftGrowth = giftGrowth;
    }

    public Integer getGiftPoint() {
        return giftPoint;
    }

    public Merchandise giftPoint(Integer giftPoint) {
        this.giftPoint = giftPoint;
        return this;
    }

    public void setGiftPoint(Integer giftPoint) {
        this.giftPoint = giftPoint;
    }

    public Integer getUsePointLimit() {
        return usePointLimit;
    }

    public Merchandise usePointLimit(Integer usePointLimit) {
        this.usePointLimit = usePointLimit;
        return this;
    }

    public void setUsePointLimit(Integer usePointLimit) {
        this.usePointLimit = usePointLimit;
    }

    public BigDecimal getScore() {
        return score;
    }

    public Merchandise score(BigDecimal score) {
        this.score = score;
        return this;
    }

    public void setScore(BigDecimal score) {
        this.score = score;
    }

    public String getPraiseProportion() {
        return praiseProportion;
    }

    public Merchandise praiseProportion(String praiseProportion) {
        this.praiseProportion = praiseProportion;
        return this;
    }

    public void setPraiseProportion(String praiseProportion) {
        this.praiseProportion = praiseProportion;
    }

    public String getParameters() {
        return parameters;
    }

    public Merchandise parameters(String parameters) {
        this.parameters = parameters;
        return this;
    }

    public void setParameters(String parameters) {
        this.parameters = parameters;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Merchandise)) {
            return false;
        }
        return id != null && id.equals(((Merchandise) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "Merchandise{" +
            "id=" + id +
            ", merchandiseCode='" + merchandiseCode + '\'' +
            ", merchandiseName='" + merchandiseName + '\'' +
            ", merchantCode='" + merchantCode + '\'' +
            ", typeCode='" + typeCode + '\'' +
            ", photos='" + photos + '\'' +
            ", deleteStatus=" + deleteStatus +
            ", publishStatus=" + publishStatus +
            ", verifyStatus='" + verifyStatus + '\'' +
            ", newStatus=" + newStatus +
            ", participateFullDiscount=" + participateFullDiscount +
            ", recommendStatus=" + recommendStatus +
            ", sort=" + sort +
            ", sale=" + sale +
            ", unit='" + unit + '\'' +
            ", serviceIds='" + serviceIds + '\'' +
            ", promotionPerLimit=" + promotionPerLimit +
            ", description='" + description + '\'' +
            ", descriptionPictures='" + descriptionPictures + '\'' +
            ", giftGrowth=" + giftGrowth +
            ", giftPoint=" + giftPoint +
            ", usePointLimit=" + usePointLimit +
            ", score=" + score +
            ", praiseProportion='" + praiseProportion + '\'' +
            ", parameters='" + parameters + '\'' +
            '}';
    }
}
